<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
 <!DOCTYPE html>
<html>

<head>
	<base href="/">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>下级用户</title>
    <meta name="keywords" content="下级用户列表">
    <meta name="description" content="下级用户列表">

    <link rel="shortcut icon" href="favicon.ico"> 
    <link href="static/templet/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="static/templet/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="static/templet/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="static/templet/css/animate.min.css" rel="stylesheet">
    <link href="static/templet/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
    <form action="user/childList" method="post" id="userForm">
        <div class="row">
        	<div class="col-sm-12">
        		<table class="table table-hover">
        			<tr>
        				<td>
        					 <input value="${param.parentId}" name="parentId" type="hidden">
							 <input value="${param.userName}" name="userName" class="form-control" placeholder="请输入用户名">
        				</td>
        				<td>
							 <input value="${param.phone}" name="phone" class="form-control" placeholder="请输入手机号">
        				</td>
        				<td>
        					<select class="form-control" name="state" id="state" data-placeholder="搜索引擎">
					            <option value="">状态</option>
					            <option value="01" <c:if test="${param.state == '01'}">selected</c:if>>启用</option>
					            <option value="02" <c:if test="${param.state == '02'}">selected</c:if>>禁用</option>
					        </select>
        				</td>
						<td>
        					<select class="form-control" name="serviceState" id="serviceState" data-placeholder="搜索引擎">
					            <option value="">服务状态</option>
					            <option value="00" <c:if test="${param.serviceState == '00'}">selected</c:if>>服务中</option>
					            <option value="01" <c:if test="${param.serviceState == '01'}">selected</c:if>>已停用</option>
					        </select>
        				</td>
        				<td>
        					<button type="button" class="btn btn-primary" onclick="searchs();">检索</button>
        				</td>
        			</tr>
        		</table>
			</div> 
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>用户名</th>
                                    <th>联系人</th>
                                    <th>角色</th>
                                    <th>联系电话</th>
                                    <th>邮箱</th>
                                    <th>昨日达标数</th>
                                    <th>昨日消费金额</th>
                                    <th>预计消费天数</th>
                                    <th>余额</th>
                                    <th>信誉值</th>
                                    <th>状态</th>
                                    <th>服务状态</th>
                                </tr>
                            </thead>
                            <tbody>
							<c:forEach items="${page.list}" var="user" varStatus="vs">
                            	<tr>
                                    <td>${user.userName }</td>
									<td>${user.petName }</td>
									<td>${user.roleName }</td>
									<td>${user.phone }</td>
									<td>${user.email }</td>
									<td>${user.yCnt }</td>
									<td>${user.yConsume }</td>
									<td>
										<c:choose>
											<c:when test="${user.yConsume.unscaledValue() eq 0}">
												<c:choose>
													<c:when test="${user.balance le 0}">
														0
													</c:when>
													<c:otherwise>-</c:otherwise>
												</c:choose>
											</c:when>
											<c:otherwise>
												<c:choose>
													<c:when test="${user.balance le 0}">
														0
													</c:when>
													<c:otherwise>
														<fmt:formatNumber type="number" value="${(user.balance-user.balance%user.yConsume)/user.yConsume}"/>
													</c:otherwise>
												</c:choose>
											</c:otherwise>
										</c:choose>
									</td>
									<td>${user.balance }</td>
									<td>${user.creditValue }</td>
									<td>
									<c:choose>
                                    	<c:when test="${user.state eq '01' }">
                                    	启用
                                    	</c:when>
                                    	<c:otherwise>
                                    	禁用
                                    	</c:otherwise>
                                    </c:choose>
									</td>
									<td>
									<c:choose>
                                    	<c:when test="${user.serviceState eq '01' }">
                                    	已停用
                                    	</c:when>
                                    	<c:otherwise>
                                    	服务中
                                    	</c:otherwise>
                                    </c:choose>
									</td>
                                    
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                        
                        <jsp:include page="/WEB-INF/jsp/page.jsp">
                        	<jsp:param value="userForm" name="form"/>
                        </jsp:include>
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>
    
    <script src="static/templet/js/jquery.min.js?v=2.1.4"></script>
    <script src="static/templet/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="static/templet/js/plugins/peity/jquery.peity.min.js"></script>
    <script src="static/templet/js/plugins/layer/layer.min.js"></script>
    <script src="static/templet/js/content.min.js?v=1.0.0"></script>
    <script src="static/templet/js/iframe.min.js"></script>
    <script type="text/javascript">

    
   
    
    function searchs(){
    	$("#userForm").submit();
    }


    </script>

</body>

</html>